package com.cx.mall.api.user;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.cx.mall.api.interceptor.HeaderInterceptor;
import com.cx.mall.common.utils.ResponseVO;
import com.cx.mall.common.model.user.UserReceiveAddress;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(contextId = "userAddress",name = "mall-user-service")
@SentinelResource
public interface UserReceiveAddressFeign {
    /**
     * 获取用户邮寄地址
     * @param id 用户Id
     * @param auth 请求头参数
     * @return
     */
    @GetMapping("/user/address/{id}")
    ResponseVO list(@PathVariable("id") Long id, @RequestHeader("Authorization") String auth);

    /**
     * 保存用户收货地址
     * @param userReceiveAddress 用户收货地址对象，包含用户ID、收货人姓名、电话、详细地址等信息
     * @return 返回保存操作的结果，包括是否成功、错误代码和错误信息等
     */
    @PostMapping("/user/address/save")
    ResponseVO save(@RequestBody UserReceiveAddress userReceiveAddress);

    /**
     * 获取用户收货地址
     * @param id 用户ID
     * @return 返回用户收货地址列表，包含用户ID、收货人姓名、电话、详细地址等信息
     */
    @GetMapping("/user/address/{id}")
    ResponseVO listById(@PathVariable("id") Long id,@RequestHeader("Authorization") String auth);
}
